package cn.chenhongchao.zhaobiaopingtai.controller;

import cn.chenhongchao.zhaobiaopingtai.common.api.CommonPage;
import cn.chenhongchao.zhaobiaopingtai.common.api.CommonResult;
import cn.chenhongchao.zhaobiaopingtai.dto.OpenBidDTO;
import cn.chenhongchao.zhaobiaopingtai.dto.ReturnBidDTO;
import cn.chenhongchao.zhaobiaopingtai.entity.BusinessBid;
import cn.chenhongchao.zhaobiaopingtai.entity.OpenTechnical;
import cn.chenhongchao.zhaobiaopingtai.entity.Tender;
import cn.chenhongchao.zhaobiaopingtai.service.impl.BusinessBidServiceImpl;
import cn.chenhongchao.zhaobiaopingtai.service.impl.OpenTechnicalServiceImpl;
import cn.chenhongchao.zhaobiaopingtai.service.impl.TenderServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/tenderOpenTechnical")
@CrossOrigin
public class TenderOpenTechnicalController {

    @Autowired
    private OpenTechnicalServiceImpl openTechnicalService;


    @Autowired
    private TenderServiceImpl tenderService;

    @PostMapping("getTenderOpenTechnicalList")
    public CommonResult getTenderReturn(@RequestParam(value = "page", required = false) Integer pageNum,
                                        @RequestParam(value = "size", required = false) Integer pageSize,
                                        @RequestBody ReturnBidDTO returnBidDTO) {

       /* System.out.println("returnBidDTO======>" + returnBidDTO);
        if (pageNum == null) {
            pageNum = 1;
        }

        if (pageSize == null) {
            pageSize = 1;
        }

        // 查询带了数据 需要动态查询  mybatis-plus
        CommonPage<OpenTechnical> returnBidCommonPage = openTechnicalService.dynamicQuery(pageNum, pageSize, returnBidDTO);
        return CommonResult.success(returnBidCommonPage);*/


        CommonPage<OpenBidDTO>  returnBidCommonPage = tenderService.getTenderList(pageNum, pageSize, returnBidDTO);


        return CommonResult.success(returnBidCommonPage);
    }

    @RequestMapping("getScheduleMax")
    public CommonResult getScheduleMax() {
        return null;
    }
}
